package com.action.boot.mongo.mongo_template.service;

import com.action.boot.mongo.mongo_template.dao.OrderDao;
import com.action.boot.mongo.mongo_template.entity.Order;
import com.mongodb.DBObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Wuxiang on 2017/9/2.
 */
@Service
public class OrderService {

    @Autowired
    OrderDao orderDao;

    public void addOrder() {
        Order order = new Order();
        order.setName("苹果");
        order.setIn("4544");
        order.setOut("12223");
        orderDao.addOrder(order);
    }

    public List<Order> selectAll() {
        return orderDao.seleceAll();
    }

    public void json(DBObject dbObject) {
        orderDao.json(dbObject);
    }

    public List<DBObject> find() {
        return orderDao.find();
    }

    public void saveOne(DBObject dbObject) {
        orderDao.saveOne(dbObject);
    }

    public void saveList(List<DBObject> dbObjects) {
        orderDao.saveList(dbObjects);
    }
}
